namespace Infrastructure.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class AddItemsTable : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.Items",
                c => new
                    {
                        ItemId = c.String(nullable: false, maxLength: 128),
                        Name = c.String(),
                        Quantity = c.Int(nullable: false),
                        Price = c.Decimal(nullable: false, precision: 18, scale: 2),
                        Product_ProductId = c.String(nullable: false, maxLength: 128),
                    })
                .PrimaryKey(t => t.ItemId)
                .ForeignKey("dbo.Products", t => t.Product_ProductId, cascadeDelete: true)
                .Index(t => t.Product_ProductId);
            
        }
        
        public override void Down()
        {
            DropIndex("dbo.Items", new[] { "Product_ProductId" });
            DropForeignKey("dbo.Items", "Product_ProductId", "dbo.Products");
            DropTable("dbo.Items");
        }
    }
}
